package com.gongpingjialoan.view;

import android.app.AlertDialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.gongpingjialoan.R;


/**
 * Created by Administrator on 2017/11/1.
 */

public class LogoutDialog extends AlertDialog {

    Context mContext;
    OnClickResultLisstener onClickResultLisstener;
    String phone;

    public LogoutDialog(Context context,String phone) {
        super(context);
        this.phone = phone;
        mContext = context;
    }

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_logout);
        TextView txt_phone = (TextView) findViewById(R.id.confirm);
        txt_phone.setText("当前帐号: "+phone);
        TextView confirmT = (TextView) findViewById(R.id.confirm);
        TextView cancleT = (TextView) findViewById(R.id.cancle);
        confirmT.setOnClickListener(new View.OnClickListener() {

            public void onClick(View v) {
                if (onClickResultLisstener != null){
                    onClickResultLisstener.confirm();
                }
                dismiss();
            }
        });

        cancleT.setOnClickListener(new View.OnClickListener() {

            public void onClick(View v) {
                dismiss();
            }
        });
    }

    public interface OnClickResultLisstener {
        void confirm();
    }

    public OnClickResultLisstener getOnClickResultLisstener() {
        return onClickResultLisstener;
    }

    public void setOnClickResultLisstener(OnClickResultLisstener onClickResultLisstener) {
        this.onClickResultLisstener = onClickResultLisstener;
    }
}
